<template>
  <div>
  <div><h3>添加列表</h3></div>
  <el-form :model="ruleForm"  ref="ruleForm" label-width="100px" class="demo-ruleForm">
    <el-form-item label="产品名称" prop="pass">
      <el-input type="productName" v-model="ruleForm.productName" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="类型ID" prop="checkPass">
      <el-input type="typeId" v-model="ruleForm.typeId" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="产品价格" prop="age">
      <el-input v-model="ruleForm.productPrice"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submitForm('ruleForm')">添加</el-button>
    </el-form-item>
  </el-form>
  </div>
</template>

<script>
import {add} from "../../../api/product/product";

export default {
  name: "AddList",
  data(){
    return{
      ruleForm:{
        productName:'',
        typeId:'',
        productPrice:''
      }

    }
  },
  methods:{
    submitForm(){
  add(this.ruleForm).then(res=>{
    console.log("add",res);
    this.$message.success('登录成功');
    this.$router.push('/productlist');
  })
}
  },
  mounted() {

  }
}
</script>

<style scoped>

</style>
